package cate.game.role.farm.tower.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTower;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;


@ClientMsg(title = "美食神殿挑战/扫荡/自动挑战请求")
@OperationSetter(value = GDOperation.TOWER_CHALLENGE, sub = "floor")
public class TowerChallengeReq implements MsgInput {
    @NoteField(value = "层数")
    public int floor;

    @NoteField(value = "是否扫荡")
    public boolean mop = false;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getFarm().tower.challenge(floor, mop);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTower.CHALLENGE_REQ;
    }
}
